home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Workbench Add-On
/
Workbench Add-On - Volume 1.iso
/
Dev
/
Oberon
/
source
/
amiga
/
Locale.mod
< prev
next >
Wrap
Text File
|
1995-06-29
|
14KB
|
430 lines
(*************************************************************************
$RCSfile: Locale.mod $
Description: Interface to locale.library
Created by: fjc (Frank Copeland)
$Revision: 3.7 $
$Author: fjc $
$Date: 1995/06/04 23:13:14 $
Includes Release 40.15
(C) Copyright 1991-1993 Commodore-Amiga, Inc.
All Rights Reserved
Oberon-A Interface Copyright © 1994-1995, Frank Copeland.
This file is part of the Oberon-A Interface.
See Oberon-A.doc for conditions of use and distribution.
*************************************************************************)
<* STANDARD- *>
MODULE [2] Locale;
IMPORT
SYS := SYSTEM, Kernel, e := Exec, u := Utility, d := Dos, s := Sets;
(*
** $VER: locale.h 38.12 (24.2.93)
**
** locale.library interface structures and definitions
*)
(*****************************************************************************)
CONST
(* constants for GetLocaleStr() *)
day1 * = 1; (* Sunday *)
day2 * = 2; (* Monday *)
day3 * = 3; (* Tuesday *)
day4 * = 4; (* Wednesday *)
day5 * = 5; (* Thursday *)
day6 * = 6; (* Friday *)
day7 * = 7; (* Saturday *)
abday1 * = 8; (* Sun *)
abday2 * = 9; (* Mon *)
abday3 * = 10; (* Tue *)
abday4 * = 11; (* Wed *)
abday5 * = 12; (* Thu *)
abday6 * = 13; (* Fri *)
abday7 * = 14; (* Sat *)
mon1 * = 15; (* January *)
mon2 * = 16; (* February *)
mon3 * = 17; (* March *)
mon4 * = 18; (* April *)
mon5 * = 19; (* May *)
mon6 * = 20; (* June *)
mon7 * = 21; (* July *)
mon8 * = 22; (* August *)
mon9 * = 23; (* September *)
mon10 * = 24; (* October *)
mon11 * = 25; (* November *)
mon12 * = 26; (* December *)
abmon1 * = 27; (* Jan *)
abmon2 * = 28; (* Feb *)
abmon3 * = 29; (* Mar *)
abmon4 * = 30; (* Apr *)
abmon5 * = 31; (* May *)
abmon6 * = 32; (* Jun *)
abmon7 * = 33; (* Jul *)
abmon8 * = 34; (* Aug *)
abmon9 * = 35; (* Sep *)
abmon10 * = 36; (* Oct *)
abmon11 * = 37; (* Nov *)
abmon12 * = 38; (* Dec *)
yesStr * = 39; (* affirmative response for yes/no queries *)
noStr * = 40; (* negative response for yes/no queries *)
amStr * = 41; (* AM *)
pmStr * = 42; (* PM *)
softHyphen * = 43; (* soft hyphenation *)
hardHyphen * = 44; (* hard hyphenation *)
openQuote * = 45; (* start of quoted block *)
closeQuote * = 46; (* end of quoted block *)
yesterdaystr * = 47; (* Yesterday *)
todaystr * = 48; (* Today *)
tomorrowstr * = 49; (* Tomorrow *)
futurestr * = 50; (* Future *)
maxStrMsg * = 51; (* current number of defined strings *)
(*****************************************************************************)
TYPE
(* OpenLibrary("locale.library",0) returns a pointer to this structure *)
LocaleBasePtr* = POINTER TO LocaleBase;
LocaleBase * = RECORD (e.LibraryBase)
libNode * : e.Library;
sysPatches - : BOOLEAN; (* TRUE if locale installed its patches *)
END;
(*****************************************************************************)
TYPE
(* This structure must only be allocated by locale.library and is READ-ONLY! *)
LocalePtr * = POINTER TO Locale;
Locale * = RECORD
localeName - : e.LSTRPTR; (* locale's name *)
languageName - : e.LSTRPTR; (* language of this locale *)
prefLanguages - : ARRAY 10 OF e.LSTRPTR; (* preferred languages*)
flags - : s.SET32; (* always 0 for now *)
codeSet - : e.ULONG; (* always 0 for now *)
countryCode - : e.ULONG; (* user's country code *)
telephoneCode - : e.ULONG; (* country's telephone code *)
gmtOffset - : LONGINT; (* minutes from GMT *)
measuringSystem - : SHORTINT; (* what measuring system? *)
calendarType - : SHORTINT; (* what calendar type? *)
reserved0 - : ARRAY 2 OF SHORTINT;
dateTimeFormat - : e.LSTRPTR; (* regular date & time format *)
dateFormat - : e.LSTRPTR; (* date format by itself *)
timeFormat - : e.LSTRPTR; (* time format by itself *)
shortDateTimeFormat - : e.LSTRPTR; (* short date & time format *)
shortDateFormat - : e.LSTRPTR; (* short date format by itself *)
shortTimeFormat - : e.LSTRPTR; (* short time format by itself *)
(* for numeric values *)
decimalPoint - : e.LSTRPTR; (* character before the decimals *)
groupSeparator - : e.LSTRPTR; (* separates groups of digits *)
fracGroupSeparator - : e.LSTRPTR; (* separates groups of digits *)
grouping - : e.ADDRESS; (* size of each group *)
fracGrouping - : e.ADDRESS; (* size of each group *)
(* for monetary values *)
monDecimalPoint - : e.LSTRPTR;
monGroupSeparator - : e.LSTRPTR;
monFracGroupSeparator - : e.LSTRPTR;
monGrouping - : e.ADDRESS;
monFracGrouping - : e.ADDRESS;
monFracDigits - : SHORTINT; (* digits after the decimal point *)
monIntFracDigits - : SHORTINT; (* for international representation *)
reserved1 - : ARRAY 2 OF SHORTINT;
(* for currency symbols *)
monCS - : e.LSTRPTR; (* currency symbol *)
monSmallCS - : e.LSTRPTR; (* symbol for small amounts *)
monIntCS - : e.LSTRPTR; (* internationl (ISO 4217) code *)
(* for positive monetary values *)
monPositiveSign - : e.LSTRPTR; (* indicate positive money value *)
monPositiveSpaceSep - : SHORTINT; (* determine if separated by space *)
monPositiveSignPos - : SHORTINT; (* position of positive sign *)
monPositiveCSPos - : SHORTINT; (* position of currency symbol *)
reserved2 - : SHORTINT;
(* for negative monetary values *)
monNegativeSign - : e.LSTRPTR; (* indicate negative money value *)
monNegativeSpaceSep - : SHORTINT; (* determine if separated by space *)
monNegativeSignPos - : SHORTINT; (* position of negative sign *)
monNegativeCSPos - : SHORTINT; (* position of currency symbol *)
reserved3 - : SHORTINT;
END;
CONST
(* constants for Locale.loc_MeasuringSystem *)
iso * = 0; (* international metric system *)
american * = 1; (* american system *)
imperial * = 2; (* imperial system *)
british * = 3; (* british system *)
(* constants for Locale.loc_CalendarType *)
ct7sun * = 0; (* 7 days a week, Sunday is the first day *)
ct7mon * = 1; (* 7 days a week, Monday is the first day *)
ct7tue * = 2; (* 7 days a week, Tuesday is the first day *)
ct7wed * = 3; (* 7 days a week, Wednesday is the first day *)
ct7thu * = 4; (* 7 days a week, Thursday is the first day *)
ct7fri * = 5; (* 7 days a week, Friday is the first day *)
ct7sat * = 6; (* 7 days a week, Saturday is the first day *)
(* constants for Locale.loc_MonPositiveSpaceSep and Locale.loc_MonNegativeSpaceSep *)
nospace * = 0; (* cur. symbol is NOT separated from value with a space *)
space * = 1; (* cur. symbol IS separated from value with a space *)
(* constants for Locale.loc_MonPositiveSignPos and Locale.loc_MonNegativeSignPos *)
parens * = 0; (* () surround the quantity and currency_symbol *)
precAll * = 1; (* sign string comes before amount and symbol *)
succAll * = 2; (* sign string comes after amount and symbol *)
precCurr * = 3; (* sign string comes right before currency symbol *)
succCurr * = 4; (* sign string comes right after currency symbol *)
(* constants for Locale.loc_MonPositiveCSPos and Locale.loc_MonNegativeCSPos *)
precedes * = 0; (* currency symbol comes before value *)
succeeds * = 1; (* currency symbol comes after value *)
(* elements of the byte arrays pointed to by:
* Locale.loc_Grouping
* Locale.loc_FracGrouping
* Locale.loc_MonGrouping
* Locale.loc_MonFracGrouping
* are interpreted as follows:
*
* 255 indicates that no further grouping is to be performed
* 0 indicates that the previous element is to be repeatedly used
* for the remainder of the digits
* <other> the number of digits that comprises the current group
*)
(*****************************************************************************)
CONST
(* Tags for OpenCatalog() *)
tagBase * = u.user + 090000H;
builtInLanguage * = tagBase+1; (* language of built-in strings *)
builtInCodeSet * = tagBase+2; (* code set of built-in strings *)
version * = tagBase+3; (* catalog version number required *)
language * = tagBase+4; (* preferred language of catalog *)
(*****************************************************************************)
CONST
(* Comparison types for StrnCmp() *)
ascii * = 0;
collate1 * = 1;
collate2 * = 2;
(*****************************************************************************)
TYPE
(* This structure must only be allocated by locale.library and is READ-ONLY! *)
CatalogPtr * = POINTER TO Catalog;
Catalog * = RECORD (e.NodeBase)
link - : e.Node; (* for internal linkage *)
pad - : e.UWORD; (* to longword align *)
language - : e.LSTRPTR; (* language of the catalog *)
codeSet - : e.ULONG; (* currently always 0 *)
version - : e.UWORD; (* version of the catalog *)
revision - : e.UWORD; (* revision of the catalog *)
END;
(*-- Library Base variable --------------------------------------------*)
CONST
localeName * = "locale.library";
VAR
base* : LocaleBasePtr;
(*-- Library Functions ------------------------------------------------*)
(*
** $VER: locale_protos.h 38.5 (18.6.93)
*)
(*--- functions in V38 or higher (Release 2.1) ---*)
PROCEDURE CloseCatalog* [base,-36]
( catalog [8] : CatalogPtr );
PROCEDURE CloseLocale* [base,-42]
( locale [8] : LocalePtr );
PROCEDURE ConvToLower* [base,-48]
( locale [8] : LocalePtr;
character [0] : CHAR )
: CHAR;
PROCEDURE ConvToUpper* [base,-54]
( locale [8] : LocalePtr;
character [0] : CHAR )
: CHAR;
PROCEDURE FormatDate* [base,-60]
( locale [8] : LocalePtr;
fmtTemplate [9] : ARRAY OF CHAR;
VAR date [10] : d.DateBase;
putCharFunc [11] : u.HookBasePtr );
PROCEDURE FormatString* [base,-66]
( locale [8] : LocalePtr;
fmtTemplate [9] : ARRAY OF CHAR;
dataStream [10] : e.APTR;
putCharFunc [11] : u.HookBasePtr )
: e.APTR;
PROCEDURE GetCatalogStr* [base,-72]
( catalog [8] : CatalogPtr;
stringNum [0] : LONGINT;
defaultString [9] : ARRAY OF CHAR )
: e.LSTRPTR;
PROCEDURE GetLocaleStr* [base,-78]
( locale [8] : LocalePtr;
stringNum [0] : e.ULONG )
: e.LSTRPTR;
PROCEDURE IsAlNum* [base,-84]
( locale [8] : LocalePtr;
character [0] : CHAR )
: BOOLEAN;
PROCEDURE IsAlpha* [base,-90]
( locale [8] : LocalePtr;
character [0] : CHAR )
: BOOLEAN;
PROCEDURE IsCntrl* [base,-96]
( locale [8] : LocalePtr;
character [0] : CHAR )
: BOOLEAN;
PROCEDURE IsDigit* [base,-102]
( locale [8] : LocalePtr;
character [0] : CHAR )
: BOOLEAN;
PROCEDURE IsGraph* [base,-108]
( locale [8] : LocalePtr;
character [0] : CHAR )
: BOOLEAN;
PROCEDURE IsLower* [base,-114]
( locale [8] : LocalePtr;
character [0] : CHAR )
: BOOLEAN;
PROCEDURE IsPrint* [base,-120]
( locale [8] : LocalePtr;
character [0] : CHAR )
: BOOLEAN;
PROCEDURE IsPunct* [base,-126]
( locale [8] : LocalePtr;
character [0] : CHAR )
: BOOLEAN;
PROCEDURE IsSpace* [base,-132]
( locale [8] : LocalePtr;
character [0] : CHAR )
: BOOLEAN;
PROCEDURE IsUpper* [base,-138]
( locale [8] : LocalePtr;
character [0] : CHAR )
: BOOLEAN;
PROCEDURE IsXDigit* [base,-144]
( locale [8] : LocalePtr;
character [0] : CHAR )
: BOOLEAN;
PROCEDURE OpenCatalogA* [base,-150]
( locale [8] : LocalePtr;
name [9] : ARRAY OF CHAR;
tags [10] : ARRAY OF u.TagItem )
: CatalogPtr;
PROCEDURE OpenCatalog* [base,-150]
( locale [8] : LocalePtr;
name [9] : ARRAY OF CHAR;
tags [10]..: u.Tag )
: CatalogPtr;
PROCEDURE OpenLocale* [base,-156]
( name [8] : ARRAY OF CHAR )
: LocalePtr;
PROCEDURE ParseDate* [base,-162]
( locale [8] : LocalePtr;
VAR date [9] : d.DateBase;
fmtTemplate [10] : ARRAY OF CHAR;
getCharFunc [11] : u.HookBasePtr )
: BOOLEAN;
PROCEDURE StrConvert* [base,-174]
( locale [8] : LocalePtr;
string [9] : ARRAY OF CHAR;
VAR buffer [10] : ARRAY OF CHAR;
bufferSize [0] : e.ULONG;
type [1] : e.ULONG )
: e.ULONG;
PROCEDURE StrnCmp* [base,-180]
( locale [8] : LocalePtr;
string1 [9] : ARRAY OF CHAR;
string2 [10] : ARRAY OF CHAR;
length [0] : LONGINT;
type [1] : e.ULONG )
: LONGINT;
(*-- Library Base variable --------------------------------------------*)
(*-----------------------------------*)
PROCEDURE* [0] CloseLib (VAR rc : LONGINT);
BEGIN (* CloseLib *)
IF base # NIL THEN e.CloseLibrary (base) END
END CloseLib;
BEGIN
base := SYS.VAL ( LocaleBasePtr,
e.OpenLibrary (localeName, e.libraryMinimum));
IF base # NIL THEN Kernel.SetCleanup (CloseLib) END
END Locale.